<template>
  <!-- 检测标准 -->
  <div>
    <div class="incolumn_countr">
      <div class="block">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <el-form-item label="输入搜索" class="s1">
            <el-input v-model="formInline.key" placeholder="请输入合作公司" style="width:150%"></el-input>
          </el-form-item>
          <el-form-item label="输入时间" label-width="230px">
            <el-date-picker
              v-model="formInline.time1"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              @change="chage"
            ></el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onsubmit">查询</el-button>
          </el-form-item>
          <el-button class="ebtn" type="warning" @click="Newly">新增标准</el-button>
        </el-form>
      </div>
    </div>
    <!-- ================ 列表 ============== -->
    <div class="Table_box">
      <template>
        <el-table
          :data="tableData"
          style="width: 99%;background-color:#fff"
          :height="650"
          :max-height="620"
          stripe
        >
          <el-table-column label="序号" type="index" align="center" width="100"></el-table-column>
          <el-table-column prop="a" label="产品名称" align="center"></el-table-column>
          <el-table-column prop="b" label="产品类型" align="center"></el-table-column>
          <el-table-column prop="c" label="检测类型" align="center"></el-table-column>
          <el-table-column prop="d" label="产品单位" align="center"></el-table-column>
          <el-table-column prop="e" label="创建时间" align="center"></el-table-column>
          <el-table-column label="操作" align="center">
            <template slot-scope="scope">
              <el-button size="small" type="warning" @click="Edit(scope.row)">编辑</el-button>
              <el-button size="small" type="primary" @click="Details(scope.row)">详情</el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>
    <!-- ======================== 分页 ===================== -->
    <div class="Ta_FenYe">
      <el-pagination
        background
        layout="prev, pager, next"
        :current-page="current"
        :page-size="pagesize"
        @current-change="handleCurrentChange"
        :total="total"
      ></el-pagination>
    </div>
    <!-- =====================  新增来料标准 ======================= -->
    <el-dialog :visible.sync="dialogVisible" :modal-append-to-body="false" width="1500px">
      <JianCe :fatherMethod="NewCancel"></JianCe>
    </el-dialog>
    <!-- ==================== 编辑 ====================== -->
    <el-dialog :visible.sync="dialogVisibleBy" :modal-append-to-body="false" width="1300px">
      <BianJi :fatherMethod="EditCancel"></BianJi>
    </el-dialog>
    <!-- =============== 详情 ================== -->
    <el-dialog :visible.sync="dialogVisibleBa" :modal-append-to-body="false" width="1300px">
      <XiangQing :fatherMethod="DetailsCancel"></XiangQing>
    </el-dialog>
  </div>
</template>

<script>
import axios from "axios";
import JianCe from "@/views/QualityManagement/PopupFile/TestStanDardNewlyAdded.vue";
import BianJi from "@/views/QualityManagement/PopupFile/TestStanDardEdit.vue";
import XiangQing from "@/views/QualityManagement/PopupFile/TestStanDardDetails.vue";
export default {
  components: {
    JianCe,
    BianJi,
    XiangQing
  },
  data() {
    return {
      total: 1,
      current: 1,
      pagesize: 10,
      no: "",
      //文本框
      formInline: {},
      //弹框
      dialogVisible: false,
      dialogVisibleBy: false,
      dialogVisibleBa: false,
      //列表表单
      tableData: [
        {
          a: "",
          b: "",
          c: "",
          d: "",
          e: ""
        }
      ]
    };
  },
  created() {
    // this.getlist(0);
    // this.getlists();
  },

  // ------------------------------------------------------------------  分割线
  // ------------------------------------------------------------------  分割线
  // ------------------------------------------------------------------  分割线
  // ------------------------------------------------------------------  分割线
  // ------------------------------------------------------------------  分割线
  // ------------------------------------------------------------------  分割线
  methods: {
    //新增
    Newly() {
      this.dialogVisible = true;
    },
    NewCancel() {
      this.dialogVisible = false;
    },
    //编辑
    Edit() {
      this.dialogVisibleBy = true;
    },
    EditCancel() {
      this.dialogVisibleBy = false;
    },
    //详情
    Details() {
      this.dialogVisibleBa = true;
    },
    DetailsCancel() {
      this.dialogVisibleBa = false;
    },
    // 分页
    handleCurrentChange(e) {
      this.getlist(e - 1);
    },

    // ------------------------------------------------------------------  分割线
    // ------------------------------------------------------------------  分割线
    // ------------------------------------------------------------------  分割线
    // 筛选
    onsubmit() {
      this.getData(0);
    },
    // 日期筛选改变
    chage(e) {
      console.log(e);
      if (e) {
        this.start =
          e[0].getFullYear() +
          "-" +
          (e[0].getMonth() + 1) +
          "-" +
          e[0].getDate();
        this.end =
          e[1].getFullYear() +
          "-" +
          (e[1].getMonth() + 1) +
          "-" +
          e[1].getDate();
      } else {
        this.start = "";
        this.end = "";
      }
    }
  }
};
</script>

<style lang="scss" scoped>
@import "@/assets/scss/base.scss";
.From_TiaoZ {
  margin-top: -40px;
}
.herd_bud {
  height: 25px;
  width: 5px;
  background-color: blue;
}
.from_bt {
  margin-top: -22px;
  margin-left: 10px;
}
.Ta_FenYe {
  height: 40px;
  margin-top: 20px;
  text-align: center;
}
//筛选栏 ---- 按钮
.block {
  margin-left: 20px;
  cursor: pointer;
}
.ebtn {
  float: right;
  margin-right: 20px;
}
//table
.Table_box {
  margin-left: 15px;
}
.Tiao_Btn {
  margin-top: 30px;
  text-align: center;
}
</style>
